package org.darkforest.vo;

import org.apache.commons.lang.StringUtils;
import org.darkforest.common.util.DateUtil;
import org.darkforest.model.GiftCardTemplate;
import org.darkforest.model.GiftDistribution;
import org.darkforest.model.GiftPackage;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017/4/21.
 */
public class GiftCustomizationVo {

    //包装
    private GiftPackage giftPackage;

    private String giftPackageJson;

    //卡片
    private GiftCardTemplate giftCardTemplate;

    private String giftCardTemplateJson;


    //定制配送
    private List<GiftDistribution> giftDistributionList;

    private String giftDistributionListJson;

    //送达时间
    private String postTime;

    //全年送订单关联的节日ID
    private String fId;

    //配送定制费用

    private BigDecimal customizationFee = new BigDecimal(0.00);

    private String customizationNames ="";
    //总费用
    private BigDecimal fee = new BigDecimal(0.00);


    public String getfId() {
        return fId;
    }

    public void setfId(String fId) {
        this.fId = fId;
    }

    public String getGiftPackageJson() {
        return giftPackageJson;
    }

    public void setGiftPackageJson(String giftPackageJson) {
        this.giftPackageJson = giftPackageJson;
    }

    public String getGiftCardTemplateJson() {
        return giftCardTemplateJson;
    }

    public void setGiftCardTemplateJson(String giftCardTemplateJson) {
        this.giftCardTemplateJson = giftCardTemplateJson;
    }

    public String getGiftDistributionListJson() {
        return giftDistributionListJson;
    }

    public void setGiftDistributionListJson(String giftDistributionListJson) {
        this.giftDistributionListJson = giftDistributionListJson;
    }

    public GiftPackage getGiftPackage() {
        return giftPackage;
    }

    public void setGiftPackage(GiftPackage giftPackage) {
        this.giftPackage = giftPackage;
    }

    public GiftCardTemplate getGiftCardTemplate() {
        return giftCardTemplate;
    }

    public void setGiftCardTemplate(GiftCardTemplate giftCardTemplate) {
        this.giftCardTemplate = giftCardTemplate;
    }

    public List<GiftDistribution> getGiftDistributionList() {
        return giftDistributionList;
    }

    public void setGiftDistributionList(List<GiftDistribution> giftDistributionList) {
        this.giftDistributionList = giftDistributionList;
    }

    public String getPostTime() {
        return postTime;
    }

    public void setPostTime(String postTime) {

        this.postTime = postTime;
    }

    public BigDecimal getFee() {
        if(giftPackage!=null)
            fee= fee.add(giftPackage.getPackagePrice());
        if(giftCardTemplate!=null)
            fee=fee.add(giftCardTemplate.getCardPrice());
        if(giftDistributionList.size()>1){
            for(GiftDistribution giftDistribution : giftDistributionList){
                fee= fee.add(giftDistribution.getDistributionItemPrice());
            }
        }

        return fee;
    }


    public BigDecimal getCustomizationFee() {
        if(giftDistributionList.size()>1){
            for(GiftDistribution giftDistribution : giftDistributionList){
                customizationFee= customizationFee.add(giftDistribution.getDistributionItemPrice());
            }
        }

        return customizationFee;
    }

    public String getCustomizationNames() {
        if(giftDistributionList.size()>1){
            for(GiftDistribution giftDistribution : giftDistributionList){
                customizationNames+=giftDistribution.getDistributionItemName()+",";
            }
            return customizationNames.substring(0,customizationNames.length()-1);

        }else{
            return "";
        }

    }

    public void setCustomizationNames(String customizationNames) {
        this.customizationNames = customizationNames;
    }

    public void setCustomizationFee(BigDecimal customizationFee) {
        this.customizationFee = customizationFee;
    }

    public void setFee(BigDecimal fee) {
        this.fee = fee;
    }
}
